package com.luoye.cc;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by dave_suwei on 2018/6/6.
 */
/**
 *
 * 暴露接口
 * management:
 *   endpoints:
 *     web:
 *       exposure:
 *         include: ["health","info","bus-refresh"]
 *
 *  post访问
 * http://localhost:8881/actuator/bus-refresh
 *
 * 谷歌浏览器安装yarc发送post请求
 *
 * 要实现动态换参数需要在引用配置的类加上 @RefreshScope
 *
 */
@SpringBootApplication
@RestController
@EnableDiscoveryClient
@RefreshScope
public class ConfigClientApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConfigClientApplication.class, args);
    }

    @Value("${foo}")
    String foo;
    @RequestMapping(value = "/hi")
    public String hi(){
        return foo;
    }
}
